﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace Project
{
   public class DBhelper
    {

        public  static DataTable GetDataTable(string sql)
        {
            string connStr = "server=.;database=Schools;uid=sa;pwd=20000624...";

            SqlConnection conn = new SqlConnection(connStr);

            conn.Open();

            SqlDataAdapter adapter = new SqlDataAdapter(sql,conn);

            DataTable table = new DataTable();

            adapter.Fill(table);

            return table;

        }
        public static int AddOrUpdateOrDelete(string sql)
        {
            string connStr = "server=.;database=Schools;uid=sa;pwd=20000624...";

            SqlConnection conn = new SqlConnection(connStr);

            conn.Open();

            SqlCommand cmd = new SqlCommand(sql,conn);

            return cmd.ExecuteNonQuery();



        }
    }
}
